package com.ishare.common.base;

import com.ishare.common.entity.po.SysUser;
import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class BaseController {
    private Logger log = LoggerFactory.getLogger(getClass());

    protected SysUser getUser() {
        SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
        log.info("获取到当前登陆用户; {},id为{}",user.getAccount(),user.getId());
        return user;
    }

    protected Long getUserId() {
        return getUser().getId();
    }
}
